#pragma once
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <string>


std::string getFragmentShaderSource(float r, float g, float b, float a= 1.0f);

class Hello_Triangle
{
private:
    /* data */
    uint32_t VAO;
    uint32_t VBO;
    uint32_t EBO;
    uint32_t shaderProgram;
    uint32_t vertexShader;
    uint32_t fragmentShader;


    float vertices[12] = {
        0.5f, 0.5f, 0.0f,   // 右上角
        0.5f, -0.5f, 0.0f,  // 右下角
        -0.5f, -0.5f, 0.0f, // 左下角
        -0.5f, 0.5f, 0.0f   // 左上角
    };

    uint32_t indices[6] = {
        // 注意索引从0开始! 
        // 此例的索引(0,1,2,3)就是顶点数组vertices的下标，
        // 这样可以由下标代表顶点组合成矩形

        0, 1, 3, // 第一个三角形
        1, 2, 3  // 第二个三角形
    };

    const char *vertexShaderSource = "#version 330 core\n"
        "layout (location = 0) in vec3 aPos;\n"
        "void main()\n"
        "{\n"
        "   gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
        "}\0";


   

public:
    Hello_Triangle(/* args */);
    void draw();
    ~Hello_Triangle();

    // std::string getVertexShaderSource();
    
};

#include <baseClass\shader.h>

class Hello_Triangles
{
private:
    uint32_t VAO[2];
    uint32_t VBO[2];
    uint32_t vertexShader;
    uint32_t shaderProgramY;
    uint32_t shaderProgramR;

    uint32_t fragmentShaderY;
    uint32_t fragmentShaderR;


    const char *vertexShaderSource = "#version 330 core\n"
        "layout (location = 0) in vec3 aPos;\n"
        "void main()\n"
        "{\n"
        "   gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
        "}\0";
    


    float firstTriangle[9] = {
        -0.9f, -0.5f, 0.0f,  // left 
        -0.0f, -0.5f, 0.0f,  // right
        -0.45f, 0.5f, 0.0f,  // top 
    };
    float secondTriangle[9] = {
        0.0f, -0.5f, 0.0f,  // left
        0.9f, -0.5f, 0.0f,  // right
        0.45f, 0.5f, 0.0f   // top 
    };



public:
    Hello_Triangles(/* args */);
    void draw();
    ~Hello_Triangles();
};
